package org.autumn.lock;

public class ConcurrentProblem {

    private static int res = 0;

    public static void main(String[] args) throws InterruptedException {
        Thread tom = new Thread(() -> {
            for (int i = 0; i < 5000; i++) {
                res++;
            }
        }, "tom");

        Thread jerry = new Thread(() -> {
            for (int i = 0; i < 5000; i++) {
                res--;
            }
        }, "jerry");

        tom.start();
        jerry.start();

        tom.join();
        jerry.join();


        System.out.println(res);
    }
}
